feat(wallpaper): add folder-based wallpaper selection and shuffle - #2990
feat(wallpaper): add folder-based wallpaper selection and shuffle#2990greenbugx wants to merge 4 commits into
Conversation
f8a6db0 to
83c600a
Compare
bbedward
left a comment
There was a problem hiding this comment.
I merged the qml-common change, so you can bump the submodule ref in this PR
a767f9a to
f298161
Compare
| folderMode: true | ||
| showHiddenFiles: true | ||
| onFileSelected: path => { | ||
| var folderPath = path.startsWith("file://") ? path.substring(7) : path; |
There was a problem hiding this comment.
onFileSelected callback already strips the file:// from path, so this can be removed. We also prefer the Paths.strip helper in general where it is needed
| onFileSelected: path => { | ||
| var folderPath = path.startsWith("file://") ? path.substring(7) : path; | ||
| var targetMonitor = SessionData.perMonitorWallpaper ? selectedMonitorName : ""; | ||
| WallpaperCyclingService.cycleToNextWallpaper(targetMonitor, folderPath + "/dummy.jpg"); |
There was a problem hiding this comment.
I think we can add a proper function in WallpaperCyclingService, would make it clearer than using dummy.jpg
function cycleFromFolder(screenName, folderPath) {
listWallpapers(folderPath, files => applyFirstWallpaper(screenName, files));
}
f298161 to
8837a22
Compare
|
@bbedward changes are done, please check again. |
8837a22 to
429b178
Compare
|
/claude review |
| process.currentWallpaper = ""; | ||
| process.goToPrevious = false; | ||
| process.running = true; | ||
| return; | ||
| } | ||
|
|
||
| var globalProcess = cyclingProcess; | ||
| globalProcess.command = findCommand(folderPath); | ||
| globalProcess.targetScreenName = screenName || ""; | ||
| globalProcess.currentWallpaper = ""; |
There was a problem hiding this comment.
Passing currentWallpaper = "" makes applyCycledWallpaper skip the first image in the folder. With currentPath === "", findIndex returns -1, so currentIndex is coerced to 0 and the non-random branch computes targetIndex = (0 + 1) % length → the second file alphabetically. So selecting a folder with 2+ wallpapers never applies the first one (and with random cycling on, the do/while excludes index 0, so the first image can't be picked on the initial selection either). Only the single-file case works, because 1 % 1 === 0.
Either apply wallpaperList[0] directly for the folder-select path (the applyFirstWallpaper shape suggested earlier), or pass a sentinel that applyCycledWallpaper understands as "start at the first entry" instead of reusing the "next from current" logic.
| if (!folderPath) | ||
| return; | ||
|
|
||
| SessionData.wallpaperCyclingFolderPath = folderPath; |
There was a problem hiding this comment.
wallpaperCyclingFolderPath is written here (and declared in SessionData.qml / SessionSpec.js) but never read anywhere — no other QML, and buildServerConfig() doesn't send it to the server either. So the "persist folder selection across restarts" goal isn't actually achieved; after a restart cycling still derives the directory from SessionData.wallpaperPath in cycle(). Either consume it (e.g. prefer it over the current wallpaper's dirname in cycle()) or drop the setting so it isn't persisted dead state.
|
|
||
| FileBrowserModal { | ||
| parentModal: root.parentModal | ||
| browserTitle: I18n.tr("Select Wallpaper Folder", "wallpaper folder file browser title") |
There was a problem hiding this comment.
Select Wallpaper Folder is a new term, but Choose wallpaper folder already exists in quickshell/translations/en.json and is already translated in several locales. CONTRIBUTING asks to reuse existing terms where possible.
| browserTitle: I18n.tr("Select Wallpaper Folder", "wallpaper folder file browser title") | |
| browserTitle: I18n.tr("Choose wallpaper folder", "wallpaper folder file browser title") |
Claude reviewFeature works end-to-end, but folder selection skips the first wallpaper and the new persisted setting is never read.
Checked: cycling logic against the |
Description
Adds a dedicated folder picker in the Settings wallpaper tab, allowing users to explicitly select an entire directory for automatic cycling without needing to manually select a dummy file.
Additionally, introduces a new Shuffle toggle to the Automatic Cycling configuration. When enabled, the background service seamlessly pipes the dynamically queried wallpaper list to
shufinstead ofsort, ensuring a truly random wallpaper is picked on every cycle while immediately adapting to any external file changes in the directory (e.g. from Nix or sync tools).Note: Depends on the
dank-qml-commonFileBrowser folderMode fix submitted in this PR to resolve folder highlighting edge cases.Type of change
Related issues
Closes #2833
Screenshots / video
recording.mp4
Checklist
I18n.tr()with translator context, reusing existing terms where possiblemake fmt, added/updated tests,make testpasses, andgo mod tidyis cleanmake lint-qmlwith no new warnings